package com.jsoft.android.exp.ffxiii;

import java.util.HashMap;
import java.util.Map;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class WeaponsPicker  extends ListActivity {

    public Map<String, String[]> charactersPicker = new HashMap<String, String[]>();
    String[] a = {"Blazefire Saber", "Axis Blade", "Edged Carbine", "Lifesaber","Gladius", "Organyx", "Hauteclaire", "Lionheart"};
    String[] b = {"Vega 42s","Spica Defenders","Deneb Duelers","Rigels","Aldebarans","Pleiades Hi-Powers","Antares Deluxes","Procyons"};
    String[] c = {"Wild Bear","Paladin","Rebel Heart","Power Circle","Feymark","Sacrificial Circle","Unsetting Sun","Umbra"};
    String[] d = {"Airwing","Hawkeye","Otshirvani","Ninurta","Vidofnir","Simurgh","Malphas","Alicanto"};
    String[] e = {"Binding Rod","Tigerclaw","Healer's Staff","Pearlwing Staff","Rod of Thorns","Mistilteinn","Belladonna Wand","Heavenly Axis"};
    String[] f = {"Bladed Lance","Dragoon Lance","Partisan","Shamanic Spear","Punisher","Pandoran Spear","Taming Pole","Gae Bolg"};
	
	/** Called when the activity is first created. */
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);



        charactersPicker.put("Lightning", a);
        charactersPicker.put("Sazh", b);
        charactersPicker.put("Snow", c);
        charactersPicker.put("Hope", d);
        charactersPicker.put("Vanelle", e);
        charactersPicker.put("Fang", f);
        
        String who = Exp.character;
		if (who.equals("ライトニング")) who="Lightning";
        setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, charactersPicker.get(who)));//WEAPONS));

        ListView lv = getListView();
        //lv.setTextFilterEnabled(true);

        lv.setOnItemClickListener(new OnItemClickListener() {
          @Override
		public void onItemClick(AdapterView<?> parent, View view,
              int position, long id) {
            // When clicked, show a toast with the TextView text
            /*Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
                Toast.LENGTH_SHORT).show();
            setResult(RESULT_OK);
            */
            
            Bundle bundle = new Bundle();
            
            bundle.putCharSequence(Exp.KEY_TITLE, ((TextView) view).getText());
            bundle.putInt(Exp.KEY_POSITION, position);
            
            Intent mIntent = new Intent();
            mIntent.putExtras(bundle);
            setResult(RESULT_OK, mIntent);
            finish();
            
          }
        });
    }
    

}